$(function() {
	$("#upload")
			.uploadify(
					{
						swf : _contextPath + '/common/uploadify/uploadify.swf',
						uploader : contextPath+'/sys/upload.htm',
						queueID : 'fileQueue',
						auto : true,
						fileObjName : 'file',
						buttonText : '选择',
						multi : false,
						queueSizeLimit : 10,
						removeCompleted : true,
						fileTypeExts : '*.jpg;*.gif;*.jpeg;*.png;*.bmp;*.zip;*.rar;*.xls;*.xlsx;*.doc;*.ppt;*.txt;*.pdf;.mp3;*.rm;*.rmvb;*.avi;*.3gp;*.mp4;*.mkv;*.flv;*.wmv',
						onUploadSuccess : function(file, data, response) {
							var obj = JSON.parse(data);
							$("#" + file.id).find("div.cancel>a").attr(
									"href",
									"javascript:onCancelWordPic('" + file.id
											+ "','" + obj.id + "');");
							var fileObj = {}

							if (obj.fileInDB) {//上传并且入库成功

								$("#uploadify_text").val(obj.filename);

							} else {
								alert("上传文件失败，请联系管理员");
							}

						},
						onError : function(event, queueID, fileObj) {
							sAlert("文件:" + fileObj.name + "上传失败");
						}
					});

});
